local dafen = fk.CreateSkill {
  name = "lingling__dafen",
}

Fk:loadTranslationTable {
  ["lingling__dafen"] = "打分",
  [":lingling__dafen"] = "每回合限一次，当你受到伤害后，你可以摸X-1张牌（X为你空余装备栏数）",
}

dafen:addEffect(fk.Damaged, {
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(dafen.name) and
      (#player:getAvailableEquipSlots() - #player:getCardIds("e") - 1) > 0 and player:usedSkillTimes(dafen.name) == 0
  end,
  on_use = function(self, event, target, player, data)
    local num = #player:getAvailableEquipSlots() - #player:getCardIds("e") - 1
    player:drawCards(num, self.name)
  end,
})

return dafen
